home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 8
/
Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso
/
Aminet
/
mus
/
play
/
tracker_4_31.lzh
/
tracker
/
Arch
/
MM1
/
audio.c
next >
Wrap
C/C++ Source or Header
|
1995-04-22
|
2KB
|
113 lines
/* mm1/audio.c
vi:ts=3 sw=3:
*/
/* $Id: audio.c,v 1.1 1995/04/22 17:49:58 espie Exp espie $
* $Log: audio.c,v $
* Revision 1.1 1995/04/22 17:49:58 espie
* Initial revision
*
*/
#include "defs.h"
#include "extern.h"
#include <sound.h>
#include <errno.h>
#define BUFSIZE 100000
#define SIG_CODE 234
#define DEFAULT_SET_MIX
#define DEFAULT_BUFFERS
#define NEW_OUTPUT_SAMPLES_AWARE
#define UNSIGNED8
#include "Arch/common.c"
ID("$Id: audio.c,v 1.1 1995/04/22 17:49:58 espie Exp espie $)
LOCAL unsigned char *buffer1, *buffer2, *ptr, *curbuf;
LOCAL int sample_rate, sigarrived;
LOCAL int samples_max;
gotsignl()
{
sigarrived = SIG_CODE;
}
int open_audio(frequency, stereo)
int frequency, stereo;
{
sample_rate = frequency ? frequency : 8000;
buffer1 = malloc(BUFSIZE);
buffer2 = malloc(BUFSIZE);
if ( buffer1 == NULL || buffer2 == NULL )
exit(_errmsg(errno, "cannot allocate buffers\n"));
buffer = buffer1;
idx = 0;
samples_max = BUFSIZE
/*
ptr = curbuf = buffer1;
*/
sigarrived = 1;
signal(SIG_CODE, gotsignl);
return sample_rate;
}
void output_samples(left, right, n)
int left, right, n;
{
void output_samples(left, right)
int left, right;
{
if (idx >= samples_max - 1)
actually_flush_buffer();
add_samples8(left, right, n);
void actually_flush_buffers()
{
if (sigarrived == 0)
sleep(0);
sigarrived = 0;
_ss_play(1, buffer, idx, sample_rate, SND_SENDSIG, SIG_CODE);
if (buffer == buffer1)
buffer = buffer2;
else
buffer = buffer1;
idx = 0;
}
void flush_buffer()
{
}
void close_audio()
{
_ss_play(1, curbuf, ptr - curbuf, sample_rate, SND_SENDSIG, SIG_CODE);
}
/* dummy system calls, to patch ? */
void set_synchro(s)
{
}
int update_frequency()
{
return 0;
}
void discard_buffer()
{
}
int output_resolution()
{
return 16;
}